<?php
global $_W, $_GPC;
$operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';

$teacherRelationTable = "hellozjx_mapwxapp_teachrelation"; //老师关系表
$orderTable = 'hellozjx_mapwxapp_order';
$videoTable = 'hellozjx_mapwxapp_video';
$userTable = 'hellozjx_mapwxapp_user';

$pindex = max(1, intval($_GPC['page']));
$psize = 20;
$keyword = trim($_GPC['keyword']);
$condition = '';
if (!empty($keyword)) {
    $condition = " AND o.payment_no LIKE '%{$keyword}%'";
}
$list = pdo_fetchall("select o.*,v.name as v_name,v.img_url,u.real_name from " . tablename($orderTable).' o'.' left join '.tablename($videoTable).' v on v.id=o.vid '.' left join '.tablename($userTable).' u on u.id=o.uid '."where o.status>0 {$condition} ORDER BY o.id DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
$total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename($orderTable) . " o WHERE status >0 " . $condition);
$pager = pagination($total, $pindex, $psize);
include $this->template('order');